Repository navigation
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
GNU diffutils testsuite comparison: |
| ignore_case: bool, | ||
| ) -> Vec<diff::Result<&'a [u8]>> { | ||
| if !ignore_case { | ||
| return diff::slice(left, right) |
There was a problem hiding this comment.
do we need to copy the whole result vector when -i isn't passed?
if diff_lines returned diff::Result<&'b &'a [u8]> (&left[i - 1] in the -i branch), this could just be return diff::slice(left, right); and the default path stays as cheap as before
|
|
||
| #[rstest] | ||
| fn ignore_case( | ||
| #[values(&[][..], &["-u"], &["-c"], &["-e"], &["-q"])] format: &[&str], |
There was a problem hiding this comment.
please add -y too, side_diff.rs is changed as well
| let posix = is_posix_locale("LC_CTYPE"); | ||
| let fold = |line: &&[u8]| -> Vec<u8> { | ||
| match std::str::from_utf8(line) { | ||
| Ok(text) if !posix => text.to_lowercase().into_bytes(), |
There was a problem hiding this comment.
str::to_lowercase applies the final sigma rule (Σ at the end of a word becomes ς), so ΟΔΟΣ and οδοσ differ with -i.
should it fold char by char instead (chars().flat_map(char::to_lowercase))?
|
it has been conflicting for more than 7 days, sorry! please rebase it |
Closes uutils#406 Compare lines through ComparisonLine with their case folded (all letters in a UTF-8 locale, ASCII letters in the POSIX locale, as GNU diff does), so every output format and -E combine with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b892ac8 to
54d8f71
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Closes #406
diff -i/--ignore-casefailed withunrecognized option. It now compares lines with their case folded and prints the original lines.Rebased on main, it builds on the
ComparisonLinecomparison key that came with-E: with-ithe key is also case folded, so every format (normal,-u,-c,-e,-q,-y) and-i -Etogether get it without touching the formatters. Folding usesto_lowercasefor UTF-8 lines, except in the C/POSIX locale (checked with the existingis_posix_locale("LC_CTYPE")), where only ASCII letters fold, as in GNU diff.-qand the exit status come from the same comparison, so case-only differences count as identical.Tests: the issue's
Funky Stuff/fUNKy stuFfwith-iand--ignore-casein the normal,-u,-c,-eand-qformats (and still different without-i), side by side output as one common line, a file that differs in more than case,-i -Etogether, and the non-ASCII case (AĀΑ-Δvsaāα-δ), equal underLC_ALL=C.UTF-8and different underLC_ALL=C. Checked against GNU diff 3.12.cargo test: all pass.AI disclosure: written with help from Claude Code.
🤖 Generated with Claude Code